From 1ec81e8864eddcd8c2dd912d4375d6f781f2b7da Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Thu, 25 May 2006 14:54:43 +0100 Subject: [PATCH] [BALLOON] Do not allow target to be set below two percent of maximum memory size. Signed-off-by: Keir Fraser --- linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c b/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c index b4ef5c1646..a1c2ea9d55 100644 --- a/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c +++ b/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c @@ -360,6 +360,12 @@ static void balloon_process(void *unused) /* Resets the Xen limit, sets new target, and kicks off processing. */ static void set_new_target(unsigned long target) { + unsigned long min_target; + + /* Do not allow target to reduce below 2% of maximum memory size. */ + min_target = max_pfn / 50; + target = max(target, min_target); + /* No need for lock. Not read-modify-write updates. */ hard_limit = ~0UL; target_pages = target; -- 2.30.2